<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%-- <%@ page import="java.text.SimpleDateFormat"%>  --%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>扫码日志列表</title>
<%@ include file="/common/importLib.jsp" %>
<script type="text/javascript" src="../common/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">

	/**
	 * 增删改查参数设置
	 */
	/* toolbarView = 0;
	tableWidth = "100%";
	tableHeight = $(window).height()-110; */
	tableTitle = "扫码日志列表";
	tableURL = getTimeURL("../maintain/userScancode/queryPageByShareCode.do");
	tableColumns = [[
	                {field:'id',title:'id',width:0,rowspan:1},
					{field:'userName',title:'扫码者',width:100,rowspan:1},
					{field:'mobilePhone',title:'手机号',width:150,rowspan:1},			
					{field:'createTimeString',title:'扫码时间',width:150,rowspan:1},
					{field:'shareCode',title:'推广码',width:100,rowspan:1},		
					{field:'promoter',title:'推广者',width:100,rowspan:1}
					]];
	$(function(){
		
		//$("#exportXls").on('click',exportXls);
	});
	
	function searchTable() {
		var form = $('#searchForm');
		$("#datagrid_table").datagrid("load", serializeForm(form));
		
		$.ajax({
			type:"post",
			url:getTimeURL("../maintain/userScancode/queryPageByShareCode.do"),
			data:serializeForm(form),
			dataType:"json",
			success:function(data){
				$("#scanCountTotal").html(data.scanCountTotal);
				$("#scanUserCountTotal").html(data.scanUserCountTotal);
			}
		});
	}
	
	function exportXls(){
		var startTime = $("#starttime").val();
		var endTime = $("#endtime").val();
		var message = '';
		if(startTime){
			message = startTime + "至" + endTime;
		}else{
			if(endTime){
				message = "至" + endTime ;
			}else{
				message = "所有";
			}
		}
		$.messager.confirm('导出', '是否导出当前老师名下发展会员的表格（时间段：'+ message +'）？' ,function(r){
			if(r){
				var teacherId = Number($('#teacherId').combobox('getValue'));
				location.href=getTimeURL("../maintain/userInfo/exportMemberListByTeacher.do?startTime="+startTime+"&endTime="+endTime+"&id="+teacherId);		
			}
		});
   } 
	//覆盖默认的方法来实现自定义 加载成功后的回调函数
	function defualtOnLoadSuccess(data){
		setTimeout(function() {	
			$("#datagrid_table").datagrid("clearSelections");
			$("#datagrid_table").datagrid("clearChecked");
			$(".xxl_linkbutton").linkbutton({plain:true});
		}, 10);
		
		$("#scanCountTotal").html(data.scanCountTotal);
		$("#scanUserCountTotal").html(data.scanUserCountTotal);
		
	}

</script>
</head>
<body id="layout" class="easyui-layout">
	<div style="background: none repeat scroll 0% 0% #EFEFEF; height:100px; padding: 6px 2px; border-bottom: 1px solid #CCC;"
		region="north"  split="false" title="条件查询">
	<form  id="searchForm" >
	<table>
		<tr>
			<td width ="10px;"></td> <td><span style="font-size: 15px;color: red;">扫码总次数：</span></td><td><span style="font-size:20px;color:green" id="scanCountTotal">0</span><span style="font-size: 15px;color: red;">&nbsp;次</span></td>			
			<td width ="30px;"><input type="hidden" name="isSearch" value="1"/></td>
			<td>扫码时间：</td>
			<td width="360px;"><input type="text" name="startTime" id="starttime" style="width: 150px;" class="input-style" onclick="WdatePicker({el:'starttime',maxDate:'#F{$dp.$D(\'endtime\')}', dateFmt: 'yyyy-MM-dd HH:mm:ss'})"/>
				<span style="padding: 0 6px 0 2px;">至</span><input type="text" name ="endTime" id="endtime"  style="width: 150px;" class="input-style" onclick="WdatePicker({el:'endtime',minDate:'#F{$dp.$D(\'starttime\')}', dateFmt: 'yyyy-MM-dd HH:mm:ss'})"/>
				</td>
			<td width="50px;"></td>
			<td>扫码者：</td><td><input type="text" name="userName" id="userName"/></td>
		</tr>
		<tr>		
			<td width ="10px;"></td><td><span style="font-size: 15px;color: red;">扫码总人数：</span></td><td><span style="font-size:20px;color:green" id="scanUserCountTotal">0</span><span style="font-size: 15px;color: red;">&nbsp;人</span></td>	
			<td width ="30px;"></td>
			<td>推广码：</td><td><input type="text" name="shareCode"  id="shareCode" /></td>	
			<td width="50px;"></td>
			<td><a class="easyui-linkbutton" id="search" iconCLs="icon-search"  onclick="searchTable();">搜索</a></td>
			<td><a class="easyui-linkbutton" iconCls="icon-undo" onclick="document.getElementById('searchForm').reset();">清空</a></td>
			<!-- <td><a class="easyui-linkbutton" iconCLs="icon-excel" id="exportXls">导出</a></td> -->
		</tr>
	</table>
	</form>
	</div>
	<div region="center">
	<!-- datagrid信息表 -->
	
	<table id="datagrid_table"></table>
		
	</div>
</body>
</html>